<%-- 
    Document   : modBorContrato
    Created on : 20-ago-2009, 20:19:54
    Author     : Ale
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" session="false" import="domain.*, planner.*, java.util.Iterator, java.util.Set, java.util.List, java.sql.Date"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>DOMECO</title>
        <link href="style.css" rel="stylesheet" type="text/css">
    </head>
    <body>
        <script type="text/javascript">
            <!--
            function abrirVentana(){
                window.open('eventos.jsp','eventos','width=300, height=400')
            }
            //-->
        </script>
        <%if (request.getSession(false) != null) {%>
        <table align="center" width="1000" border="0">
            <tr>
                <td>
                    <div id="menu" align="center"><jsp:include page="./menu principal.jsp"></jsp:include></div>
                    <br>
                    <p id="campoAzul" align="center" valign="middle" width="235px"><span id="blanco">Electricidad</span><br></p>
                    <span id="azulTitulo"> Modificar/Borrar Contratos</span>
                    <div id="general">
                        <div id="cuenta" align="center" >
                            <%
    Userdom user = (Userdom) request.getSession().getAttribute("user");
    Operations o = new Operations();
    List l = o.getElecContrList(user);
    double power = 0.0;
    double amount = 0.0;
    if (l.isEmpty()) {
                            %>
                            <br>
                            <br>
                            <p align=right"><span id="rojo"> Noy hay Contratos de Electricidad</span></p>
                            <%} else {
                                Iterator it1 = l.iterator();
                                while (it1.hasNext()) {
                                    Electricitycontract e = (Electricitycontract) it1.next();
                                    power = e.getContratedPower();
                                    Integer idContract = e.getIdElectricityContract();
                            %>
                            <p align=center"><span id="datosCuenta">Contrato: <%=e.getContract().getNameContract()%>, Potencia: <%=power%>, Compañia: <%=e.getCompany()%></span></p><p><a href="./Delete?type=electricityContract&idElectricityContract=<%=idContract%>&redir=E"><img src="/Imagenes/eliminar.gif"></a>   <a href="./modificarContratoElectricidad.jsp?idElectricityContract=<%=idContract%>"><img src="/Imagenes/modificar.gif"></a></p>
                            <%

        }
    }

                            %>


                        </div>



                        <div id="barraDer">

                            <div id="accesos">
                                <table align="center">
                                    <tr ><td id="campoAzul" align="center" valign="middle" width="235px"><span id="blanco">Accesos frecuentes</span><br></td></tr>
                                </table>
                                <p align="center"><a href="./nuevoContElectricidad.jsp" id="colorEvento"><span onmouseover='this.style.color="#FF9900"' onmouseout='this.style.color="#79A9D9"'>A&ntilde;adir Contrato Electricidad</span></a></p>
                                <p align="center"><a href="./nuevaFacturaElectricidad.jsp" id="colorEvento"><span onmouseover='this.style.color="#FF9900"' onmouseout='this.style.color="#79A9D9"'>A&ntilde;adir factura</span></a></p>
                                <p align="center">  <a href="./modBorContrato.jsp" id="colorEvento"><span onmouseover='this.style.color="#FF9900"' onmouseout='this.style.color="#79A9D9"'>Modificar/Borrar contrato</span></a></p>
                                <p align="center"><a href="./calcularPotencia.jsp" id="colorEvento"><span onmouseover='this.style.color="#FF9900"' onmouseout='this.style.color="#cc0000"'>Calcular Potencia</span></a></p>

                            </div>


                        </div>
                    </div>

                    <div id="abajo" align="center"><p>&copy;   Domeco &mdash; Proyecto Informático A&ntilde;o 2009 </p></div>
                </td>
            </tr>
        </table>
        <%} else {%>
        <jsp:forward page="./index.jsp"></jsp:forward>
        <%}%>
    </body>
</html>
